USE [ERP]
GO

/****** Object:  Table [dbo].[EmployeePayments]    Script Date: 11/16/2009 14:33:03 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[EmployeePayments](
	[EmployeeID] [nvarchar](50) NOT NULL,
	[LoanID] [nvarchar](50) NOT NULL,
	[Amount] [float] NULL,
	[Date] [datetime] NOT NULL,
	[Notes] [nvarchar](50) NULL,
 CONSTRAINT [PK_EmployeePayments] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC,
	[LoanID] ASC,
	[Date] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[EmployeePayments]  WITH CHECK ADD  CONSTRAINT [FK_EmployeePayments_EmployeeLoans] FOREIGN KEY([LoanID])
REFERENCES [dbo].[EmployeeLoans] ([LoanID])
GO

ALTER TABLE [dbo].[EmployeePayments] CHECK CONSTRAINT [FK_EmployeePayments_EmployeeLoans]
GO

ALTER TABLE [dbo].[EmployeePayments]  WITH CHECK ADD  CONSTRAINT [FK_EmployeePayments_Employees] FOREIGN KEY([EmployeeID])
REFERENCES [dbo].[Employees] ([ID])
GO

ALTER TABLE [dbo].[EmployeePayments] CHECK CONSTRAINT [FK_EmployeePayments_Employees]
GO

